package com.xperblueray.stepbystep.producer;

import com.xperblueray.stepbystep.model.SbsMood;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.jms.Destination;

@Service
public class SbsMoodProducer {

    // 发消息的工具类，也可以注入Jmstemplate， JmsMessagingTemplate对jmsTemplate进行了封装
    @Resource
    private JmsMessagingTemplate jmsMessagingTemplate;

    public void sendMessage(Destination destination, final String message) {
        jmsMessagingTemplate.convertAndSend(destination, message);
    }
    public void sendMessage(Destination destination, final SbsMood sbsMood) {
        jmsMessagingTemplate.convertAndSend(destination, sbsMood);
    }
}
